package com.zb.nio.c4;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;

/**
 * @author: zhaobin
 * @date: 2024/3/16 16:06
 * @Description:
 */
public class Client {

    public static void main(String[] args) throws IOException {
        SocketChannel socketChannel = SocketChannel.open();
        socketChannel.connect(new InetSocketAddress("localhost",8080));
        System.out.println("waiting...");
        socketChannel.write(Charset.defaultCharset().encode("hello!"));
    }
}
